package org.qpcr.community.project.enums;

import lombok.Getter;

@Getter
public enum DataAnalysisChartType {
    //饼图、环状体、折线图、柱状图
    PIE("pine", "饼图"),
    RING("ring", "环状体"),
    LINE("line", "折线图"),
    BAR("bar", "柱状图");

    private final String code;
    private final String name;

    DataAnalysisChartType(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static DataAnalysisChartType getByCode(String code) {
        for (DataAnalysisChartType type : DataAnalysisChartType.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
    public static DataAnalysisChartType getByName(String name) {
        for (DataAnalysisChartType type : DataAnalysisChartType.values()) {
            if (type.getName().equals(name)) {
                return type;
            }
        }
        return null;
    }
}
